Mapping Sea Surface Temperature using NOAA Data

Libraries

library(ncdf4)
library(raster)
## Loading required package: sp

The Data

How is environmental data organized?

Earth scientists such as geographers and oceanographers use a special data format specifically designed for Earth science data known as NetCDF (Network Common Data Form). NetCDF is specially suited for spatial data about the Earth because it organizes data points into layers. Each layer represents one time step, and contains the longitude, latitude, and data points for one moment in time. Scientists can examine how the data changes over time by navigating between these layers. The R library ncdf4 allows us to use and manipulate NetCDF files progammatically.

How can I access environmental data?

NOAA has several data products monitoring and estimating sea surface temperature. One of these is CoRTAD, the Coral Reef Temperature Anomaly Database, which contains metrics related to thermal stress in coral reefs. We will access this database through a data server known as THREDDS (Thematic Real-time Environmental Distributed Data Services). If you visit the NOAA THREDDS webiste, you will see CoRTAD has several files to choose from, each featuring a difference metric. For our purposes today, we will focus on the “Filled SST Mean”, “Sea Surface Temperature Anomaly (SSTA)”, and “Thermal Stress Anomaly (TSA)”.

The ncdf4 nc_open() function allows us to open a NetCDF file by supplying a path on your local machine or a URL to a data server. We will use the URL pointing to the CoRTAD files of interest. After we open the file, we can view it in R. This will show us the information (metadata) attached to it. This tells us the variable names, coordinates (such as time, latitude, and longitude), as well as other useful information.

Let’s start with CoRTAD’s “Filled SST” dataset. This contains the weekly average sea surface temperatures from 1982 to 2019. Points on the globe which were not directly measured are filled in with statistical estimates.

# CoRTAD Filled SST
url <- "https://www.ncei.noaa.gov/thredds-ocean/dodsC/cortad/Version6/cortadv6_FilledSST.nc"
data <- nc_open(url)
data
## File https://www.ncei.noaa.gov/thredds-ocean/dodsC/cortad/Version6/cortadv6_FilledSST.nc (NC_FORMAT_CLASSIC):
## 
##      12 variables (excluding dimension variables):
##         float time_bounds[nv,time]   
##             units: days since 1981-12-31
##             comment: time bounds for each time value
##             _ChunkSizes: 1
##              _ChunkSizes: 2
##         float lat_bounds[nv,lat]   
##             units: degrees_north
##             comment: latitude values at the north and south bounds of each pixel
##         float lon_bounds[nv,lon]   
##             units: degrees_east
##             comment: longitude values at the west and east bounds of each pixel
##         int crs[]   
##             grid_mapping_name: latitude_longitude
##             semi_major_axis: 6378137
##             inverse_flattening: 298.257223563
##             epsg_code: EPSG:4326
##             comment: This is a container variable that describes the grid_mapping used by the data in this file. This variable does not contain any data; only information about the geographic coordinate system.
##         byte land[lon,lat]   
##             _Unsigned: false
##             standard_name: land_binary_mask
##             long_name: A matrix showing which pixels are on land. No analyses take place at those locations
##             grid_mapping: crs
##             add_offset: 0
##             scale_factor: 1
##             coordinates: lon lat
##         short NumberGood[lon,lat]   
##             long_name: A matrix showing how many of the original SST observations are valid prior to any gap-filling.
##             coordinates: lon lat
##             grid_mapping: crs
##             _ChunkSizes: 540
##              _ChunkSizes: 540
##         byte AllBad[lon,lat]   
##             _Unsigned: false
##             long_name: A matrix showing which pixels are always missing. These missing pixels are not gap-filled and no analysis takes  place at those locations.
##             coordinates: lon lat
##             grid_mapping: crs
##             _ChunkSizes: 540
##              _ChunkSizes: 540
##         short FilledSST[lon,lat,time]   
##             standard_name: sea_surface_skin_temperature
##             long_name: Gap-Filled weekly SST time series
##             units: Kelvin
##             coordinates: lon lat
##             grid_mapping: crs
##             add_offset: 273.15
##             scale_factor: 0.01
##             valid_min: -180
##             valid_max: 4500
##             land_value: -1100
##             _FillValue: -1100
##             missing_pixel_value: -1100
##             source: The weekly sea surface temperature is derived from Pathfinder 5.3 SST.
##             _ChunkSizes: 65
##              _ChunkSizes: 540
##              _ChunkSizes: 540
##         short FilledSSTminimum[lon,lat]   
##             standard_name: minimum_of_gap_filled_sea_surface_skin_temperature
##             long_name: A matrix showing the minimum value at each FilledSST pixel
##             units: Kelvin
##             coordinates: lon lat
##             grid_mapping: crs
##             add_offset: 273.15
##             scale_factor: 0.01
##             _FillValue: -1100
##             missing_pixel_value: -1100
##             _ChunkSizes: 864
##              _ChunkSizes: 1728
##         short FilledSSTmaximum[lon,lat]   
##             standard_name: maximum_of_gap_filled_sea_surface_skin_temperature
##             long_name: A matrix showing the maximum value at each FilledSST pixel
##             units: Kelvin
##             coordinates: lon lat
##             grid_mapping: crs
##             add_offset: 273.15
##             scale_factor: 0.01
##             _FillValue: -1100
##             missing_pixel_value: -1100
##             _ChunkSizes: 864
##              _ChunkSizes: 1728
##         short FilledSSTstandardDeviation[lon,lat]   
##             long_name: The standard deviation of the gap filled weekly SST averages
##             units: Kelvin
##             coordinates: lon lat
##             grid_mapping: crs
##             add_offset: 0
##             scale_factor: 0.01
##             _FillValue: -1100
##             missing_pixel_value: -1100
##             _ChunkSizes: 540
##              _ChunkSizes: 540
##         short FilledSSTmean[lon,lat]   
##             standard_name: mean_of_gap_filled_sea_surface_skin_temperature
##             long_name: A matrix showing the mean value at each FilledSST pixel
##             units: Kelvin
##             coordinates: lon lat
##             grid_mapping: crs
##             add_offset: 273.15
##             scale_factor: 0.01
##             _FillValue: -1100
##             missing_pixel_value: -1100
##             _ChunkSizes: 864
##              _ChunkSizes: 1728
## 
##      4 dimensions:
##         time  Size:2086   *** is unlimited *** 
##             standard_name: time
##             long_name: reference time of weekly SST averages
##             units: days since 1981-12-31
##             comment: The week runs from Saturday through Friday. Time is the middle of the week (Tuesday)
##             axis: T
##             calendar: Gregorian
##             bounds: time_bounds
##             _ChunkSizes: 1048576
##         lat  Size:4320 
##             standard_name: latitude
##             units: degrees_north
##             reference_datum: geographical coordinates, WGS84 projection
##             axis: Y
##             valid_min: -89.9791717529297
##             valid_max: 89.9791717529297
##             bounds: lat_bounds
##         lon  Size:8640 
##             standard_name: longitude
##             units: degrees_east
##             reference_datum: geographical coordinates, WGS84 projection
##             axis: X
##             valid_min: -179.979202270508
##             valid_max: 179.979202270508
##             bounds: lon_bounds
##         nv  Size:2 (no dimvar)
## 
##     69 global attributes:
##         Conventions: CF-1.6
##         title: Gap-filled Weekly-Averaged SST Time Series from 1982-2020, after application of median-fill and temporal-fill procedures [Coral Reef Temperature Anomaly Database (CoRTAD) Version 6]
##         summary: This netCDF-4 file contains Gap-filled Weekly-Averaged SST Time Series from 1982-2020, after application of median-fill and temporal-fill procedures and is part of a collection of sea surface temperature (SST) and related thermal stress metrics, developed specifically for coral reef ecosystem applications but relevant to other ecosystems as well. The CoRTAD Version 6 contains global, approximately 4 km resolution SST data on a weekly time scale from 1982 through 2020. In addition to SST, it contains SST anomaly (SSTA, weekly SST minus weekly climatological SST), thermal stress anomaly (TSA, weekly SST minus the maximum weekly climatological SST), SSTA Degree Heating Week (SSTA_DHW, sum of previous 12 weeks when SSTA is greater than or equal to 1 degree C), SSTA Frequency (number of times over previous 52 weeks that SSTA is greater than or equal to 1 degree C), TSA DHW (TSA_DHW, also known as a Degree Heating Week, sum of previous 12 weeks when TSA is greater than or equal to 1 degree C),and TSA Frequency (number of times over previous 52 weeks that TSA is greater than or equal to 1 degree C). The CoRTAD also includes ancillary information on sea ice fraction and wind speeds.
##         references: Saha, Korak, Zhao, Xuepeng, Zhang, Huai-min, Casey, Kenneth S., Zhang, Dexin, Baker-Yeboah, Sheekela, Kilpatrick, Katherine A., Evans, Robert H., Ryan, Thomas, Relph, John M. (2018). AVHRR Pathfinder Version 5.3 Level 3 Collated (L3C) Global 4km Sea Surface Temperature for 1981-Present. NOAA National Centers for Environmental Information. Dataset. doi:10.7289/V52J68XX. [access date]
##         institution: US DOC; NOAA; National Environmental Satellite Data and Information Service; National Centers for Environmental Information
##         history: cd ./FilledSST_Reader/run; ./gen_weekly_input.sh > weekly_namelist_input_files; ./cli_FilledSST_pf.sh >& cli_FilledSST_pf.log; ./create_FilledSST_nc.sh >& create_FilledSST_nc.log
##         comment: CoRTAD weekly sea surface temperature is derived from Pathfinder 5.3 variable "sea_surface_temperature"
##         license: These data are available for use without restriction.
##         id: 0
##         naming_authority: gov.noaa.nodc
##         product_version: V6.0
##         uuid: 0846F0C7-7BC4-4409-A462-4B10CFBE2851
##         netcdf_version_id: 4.3.3.1
##         date_created: 20220524T014654Z
##         date_issued: 20220524T014654Z
##         geospatial_lat_units: degrees north
##         geospatial_lat_resolution: 0.04165 degrees
##         geospatial_lon_units: degrees east
##         geospatial_lon_resolution: 0.04165 degrees
##         geospatial_vertical_units: meters
##         geospatial_vertical_resolution: point
##         geospatial_vertical_positive: down
##         geospatial_lon_min: -179.979202270508
##         geospatial_lon_max: 179.979202270508
##         geospatial_lat_min: -89.9791717529297
##         geospatial_lat_max: 89.9791717529297
##         geospatial_vertical_min: 0
##         geospatial_vertical_max: 0
##         northernmost_latitude: 89.9791717529297
##         southernmost_latitude: -89.9791717529297
##         easternmost_longitude: 179.979202270508
##         westernmost_longitude: -179.979202270508
##         time_coverage_start: 19820102T000000Z
##         time_coverage_end: 20211224T235959Z
##         time_coverage_units: days
##         time_coverage_duration: P31Y1M28D
##         time_coverage_resolution: P7D
##         source: Version 6 of the Coral Reef Temperature Anomaly Database (CoRTAD) is a global, 4 km, sea surface temperature (SST) and related thermal stress metrics dataset for 1982-01-02 to 2020-12-25. The CoRTAD contains weekly-averaged SSTs, SST anomaly (SSTA, weekly SST minus weekly climatological SST), thermal stress anomaly (TSA, weekly SST minus the maximum weekly climatological SST), SSTA Degree Heating Week (SSTA_DHW, sum of previous 12 weeks when SSTA is greater than or equal to 1 degree C), SSTA Frequency (number of times over previous 52 weeks that SSTA is greater than or equal to 1 degree C), TSA DHW (TSA_DHW, also known as a Degree Heating Week, sum of previous 12 weeks when TSA is greater than or equal to 1 degree C), and TSA Frequency (number of times over previous 52 weeks that TSA is greater than or equal to 1 degree C). In addition, the CoRTAD includes ancillary sea ice concentration and marine winds speed data.
##         platform: NOAA-7, NOAA-9, NOAA-11, NOAA-9, NOAA-14, NOAA-16, NOAA-17, NOAA-18, NOAA-19
##         sensor: AVHRR_GAC
##         grid_mapping: Equidistant Cylindrical
##         Metadata_Conventions: Unidata Dataset Discovery v1.0
##         metadata_link: http://www.nodc.noaa.gov/SatelliteData/Cortad/
##         keywords: Oceans > Ocean Temperature > Sea Surface Temperature
##         keywords_vocabulary: NASA/Global Change Master Directory (GCMD) Earth Science Keywords v8.0
##         standard_name_vocabulary: Climate and Forecast (CF) Standard Name Table v27
##         acknowledgment: Please acknowledge the use of these data with the following statement: These data were provided by GHRSST and the US National Oceanographic Data Center. This project was supported in part by a grant from the NOAA Climate Data Record (CDR) Program for satellites.
##         creator_name: Kenneth S. Casey
##         creator_email: Kenneth.Casey@noaa.gov
##         creator_url: http://www.nodc.noaa.gov/SatelliteData/Cortad/
##         contributor_name: Elizabeth R. Selig
##         contributor_role: Principal Investigator
##         project: Coral Reef Temperature Anomaly Database
##         publisher_name: National Centers for Environmental Information (NCEI), NOAA
##         publisher_email: NODC.Services@noaa.gov
##         publisher_url: http://www.nodc.noaa.gov/
##         processing_level: Level 4
##         cdm_data_type: Grid
##         feature_type: Grid
##         nodc_template_version: NODC_NetCDF_Grid_Template_v1.1
##         platform_dates: NOAA-7 1981236-1985003, NOAA-9 1985004-1988312, NOAA-11 1988313-1994256, NOAA-9 1994257-1995021, NOAA-14 1995022-2000285, NOAA-16 2000286-2002365, NOAA-17 2003001-2005155, NOAA-18 2005156-2010365, NOAA-19 2011001-2020366
##         instrument: AVHRR_GAC
##         project_acronym: CoRTAD
##         project_support: National Centers for Environmental Information (NCEI), NOAA Coral Reef Conservation Program (CRCP)
##         time_period_covered: Weekly, 1982-01-02 - 2021-12-24
##         rows: 4320
##         cols: 8640
##         timesteps: 2086
##         DODS_EXTRA.Unlimited_Dimension: time

Calling the data variable will print out the dataset’s metadata. It looks like a lot, but it actually contains useful information! For one, we can see that the dataset contains many variables plotted over longitude, latitude, and time. We don’t need all of those variables. Instead, we can choose the variables we want to work with using the ncvar_get command by supplying the NetCDF object and the dataset variable name. In this case, let’s look at “FilledSSTmean”. The long name of this variable gives us an idea of what it contains: “a matrix showing the mean value for each pixel in Kelvin”. In other words, this is the average SST value for each point in the dataset.

sst_mean <- ncvar_get(data, "FilledSSTmean")

We also want to grab the coordinates that “FilledSSTmean” uses. From the metadata, we can see that “FilledSSTmean” is a matrix organized by [lon, lat] (longitude and latitude). We can use the same ncvar_get command to pull these coordinates from the data.

(Side note: it’s common for latitude in NetCDF to be stored in reverse of how we want it in R. For now, just know that we use the rev function to make mapping easier on ourselves)

lon <- ncvar_get(data, "lon")
lat <- ncvar_get(data, "lat")
lat <- rev(lat)

After you are done accessing your variables, it is good practice to close the server connection with nc_close()

nc_close(data)

Now that we have all the variables we need, let’s get to plotting!

Plotting the Data

To plot our NetCDF data, we first need to convert it to a raster. A raster is a spatial grid where each cell represents a pixel on an image. This can be accomplished by calling the raster function and supplying the variable we want to plot (sst_mean), as well as the range of the coordinate values (x-axis for longitude, and y-axis for latitude). Once it is “rasterized,” we can simply plot it in R using the base plot function.

r <- raster(t(sst_mean), xmn = min(lon), xmx = max(lon), ymn = min(lat), ymx = max(lat))

plot(r, col=topo.colors(100))

What a nice map! Notice that we didn’t import any map images to overlay on the data. Since our dataset contains sea surface temperature around the globe, we can see landmasses due to their lack of data values.

Sea surface temperature is a good metric for visualizing the temperature of our oceans. However, SST is a raw measurement that doesn’t account for seasonal changes. In the northern hemisphere, we have hotter temperatures in June-August and cooler temperatures in December-February. These natural fluctuations in temperature (called the climatology) make it difficult to visualize how the climate is changing. To solve this problem, scientists calculate a metric known as the Sea Surface Temperature Anomaly. This measurement takes the sea surface temperature at a point in time and compares it to the average temperature at that location for a climatological period (typicallly 30 years). CoRTAD’s Sea Surface Temperature Anomaly dataset lets us explore this metric ourselves.

Because this dataset is so large, we will not download the full dataset. For this notebook, we will compare information from the first year of the data (1982) to the last year of the data (2019).

ssta_first_url <- "https://www.ncei.noaa.gov/thredds-ocean/dodsC/cortad/Version6/cortadv6_SSTA.nc?time[0:1:0],lat[0:1:4319],lon[0:1:8639],SSTA[0:1:0][0:1:4319][0:1:8639],SSTA_Minimum[0:1:4319][0:1:8639],SSTA_Maximum[0:1:4319][0:1:8639],SSTA_Mean[0:1:4319][0:1:8639],SSTA_Frequency[0:1:0][0:1:4319][0:1:8639]"
ssta_last_url <- "https://www.ncei.noaa.gov/thredds-ocean/dodsC/cortad/Version6/cortadv6_SSTA.nc?time[2085:1:2085],lat[0:1:4319],lon[0:1:8639],SSTA[2085:1:2085][0:1:4319][0:1:8639],SSTA_Minimum[0:1:4319][0:1:8639],SSTA_Maximum[0:1:4319][0:1:8639],SSTA_Mean[0:1:4319][0:1:8639],SSTA_Frequency[2085:1:2085][0:1:4319][0:1:8639]"
ssta_first <- nc_open(ssta_first_url)
ssta_last <- nc_open(ssta_last_url)
ssta_first
## File https://www.ncei.noaa.gov/thredds-ocean/dodsC/cortad/Version6/cortadv6_SSTA.nc?time[0:1:0],lat[0:1:4319],lon[0:1:8639],SSTA[0:1:0][0:1:4319][0:1:8639],SSTA_Minimum[0:1:4319][0:1:8639],SSTA_Maximum[0:1:4319][0:1:8639],SSTA_Mean[0:1:4319][0:1:8639],SSTA_Frequency[0:1:0][0:1:4319][0:1:8639] (NC_FORMAT_CLASSIC):
## 
##      5 variables (excluding dimension variables):
##         short SSTA[lon,lat,time]   
##             long_name: Weekly SST Anomalies
##             units: Kelvin
##             coordinates: lon lat
##             grid_mapping: crs
##             add_offset: 0
##             scale_factor: 0.01
##             _FillValue: -32768
##             _ChunkSizes: 130
##              _ChunkSizes: 540
##              _ChunkSizes: 540
##         short SSTA_Minimum[lon,lat]   
##             long_name: A matrix showing the minimum value at each SSTA pixel
##             units: Kelvin
##             coordinates: lon lat
##             grid_mapping: crs
##             add_offset: 0
##             scale_factor: 0.01
##             _FillValue: -32768
##             _ChunkSizes: 540
##              _ChunkSizes: 540
##         short SSTA_Maximum[lon,lat]   
##             long_name: A matrix showing the maximum value at each SSTA pixel
##             units: Kelvin
##             coordinates: lon lat
##             grid_mapping: crs
##             add_offset: 0
##             scale_factor: 0.01
##             _FillValue: -32768
##             _ChunkSizes: 540
##              _ChunkSizes: 540
##         short SSTA_Mean[lon,lat]   
##             long_name: A matrix showing the mean at each SSTA pixel
##             units: Kelvin
##             coordinates: lon lat
##             grid_mapping: crs
##             add_offset: 0
##             scale_factor: 0.01
##             _FillValue: -32768
##             _ChunkSizes: 540
##              _ChunkSizes: 540
##         byte SSTA_Frequency[lon,lat,time]   
##             _Unsigned: false
##             long_name: Frequency of SST Anomalies >= 1 deg C over previous 52 weeks
##             coordinates: lon lat
##             grid_mapping: crs
##             add_offset: 0
##             scale_factor: 1
##             _FillValue: -128
##             units: Weeks
##             _ChunkSizes: 130
##              _ChunkSizes: 540
##              _ChunkSizes: 540
## 
##      3 dimensions:
##         time  Size:1   *** is unlimited *** 
##             standard_name: time
##             long_name: reference time of weekly SST averages
##             units: days since 1981-12-31
##             comment: The week runs from Saturday through Friday. Time is the middle of the week (Tuesday)
##             axis: T
##             calendar: Gregorian
##             bounds: time_bounds
##             _ChunkSizes: 1
##         lat  Size:4320 
##             standard_name: latitude
##             units: degrees_north
##             reference_datum: geographical coordinates, WGS84 projection
##             axis: Y
##             valid_min: -89.9791717529297
##             valid_max: 89.9791717529297
##             bounds: lat_bounds
##         lon  Size:8640 
##             standard_name: longitude
##             units: degrees_east
##             reference_datum: geographical coordinates, WGS84 projection
##             axis: X
##             valid_min: -179.979202270508
##             valid_max: 179.979202270508
##             bounds: lon_bounds
## 
##     69 global attributes:
##         Conventions: CF-1.6
##         title: Sea Surface Temperature Anomaly (SSTA) and related statistical parameters from 1982-2020 [Coral Reef Temperature Anomaly Database (CoRTAD) Version 6]
##         summary: This netCDF-4 file contains Sea Surface Temperature Anomaly (SSTA) and related statistical parameters from 1982-2020 and is part of a collection of sea surface temperature (SST) and related thermal stress metrics, developed specifically for coral reef ecosystem applications but relevant to other ecosystems as well. The CoRTAD Version 6 contains global, approximately 4 km resolution SST data on a weekly time scale from 1982 through 2020. In addition to SST, it contains SST anomaly (SSTA, weekly SST minus weekly climatological SST), thermal stress anomaly (TSA, weekly SST minus the maximum weekly climatological SST), SSTA Degree Heating Week (SSTA_DHW, sum of previous 12 weeks when SSTA is greater than or equal to 1 degree C), SSTA Frequency (number of times over previous 52 weeks that SSTA is greater than or equal to 1 degree C), TSA DHW (TSA_DHW, also known as a Degree Heating Week, sum of previous 12 weeks when TSA is greater than or equal to 1 degree C),and TSA Frequency (number of times over previous 52 weeks that TSA is greater than or equal to 1 degree C). The CoRTAD also includes ancillary information on sea ice fraction and wind speeds.
##         references: Saha, Korak, Zhao, Xuepeng, Zhang, Huai-min, Casey, Kenneth S., Zhang, Dexin, Baker-Yeboah, Sheekela, Kilpatrick, Katherine A., Evans, Robert H., Ryan, Thomas, Relph, John M. (2018). AVHRR Pathfinder Version 5.3 Level 3 Collated (L3C) Global 4km Sea Surface Temperature for 1981-Present. NOAA National Centers for Environmental Information. Dataset. doi:10.7289/V52J68XX. [access date]
##         institution: US DOC; NOAA; National Environmental Satellite Data and Information Service; National Centers for Environmental Information
##         history: $bindir/make_data_ssta_1.x ${CoRTAD_Land_Dir}/land_data_for_CoRTAD_v6.dat ${CoRTAD_SST_Dir}/FilledCNT/filledSST_main ${CoRTAD_HM_Dir}/HarmonicFIT/harmonicSST_main ${CoRTAD_SSTA_Dir}/SSTA1/sstANOM_main $nsegs $tsegs; $bindir/make_data_ssta_2.x ${CoRTAD_Land_Dir}/land_data_for_CoRTAD_v6.dat ${CoRTAD_SST_Dir}/FilledCNT/filledSST_main ${CoRTAD_HM_Dir}/HarmonicFIT/harmonicSST_main ${CoRTAD_SSTA_Dir}/SSTA2/sstANOM_DHW_main $nsegs $tsegs; $bindir/make_data_ssta_3.x ${CoRTAD_Land_Dir}/land_data_for_CoRTAD_v6.dat ${CoRTAD_SST_Dir}/FilledCNT/filledSST_main ${CoRTAD_HM_Dir}/HarmonicFIT/harmonicSST_main ${CoRTAD_SSTA_Dir}/SSTA3/sstANOM_FREQ_main $nsegs $tsegs; submit_task $bindir/ssta_lltm_1.x ${CoRTAD_SSTA_Dir}/SSTA1/sstANOM_main ${CoRTAD_SSTA_Dir}/SSTA_tm1/sstANOM_main_tm ${CoRTAD_SSTA_Dir}/SSTA_tm1/sstANOM_main_stats.dat 64 16 Log=LOG/ssta_lltm_sstANOM_main.log; submit_task $bindir/ssta_lltm_23.x ${CoRTAD_SSTA_Dir}/SSTA2/sstANOM_DHW_main ${CoRTAD_SSTA_Dir}/SSTA_tm2/sstANOM_DHW_main_tm ${CoRTAD_SSTA_Dir}/SSTA_tm2/sstANOM_DHW_main_stats.dat 64 16 Log=LOG/ssta_lltm_sstANOM_DHW_main.log; submit_task $bindir/ssta_lltm_23.x ${CoRTAD_SSTA_Dir}/SSTA3/sstANOM_FREQ_main ${CoRTAD_SSTA_Dir}/SSTA_tm3/sstANOM_FREQ_main_tm ${CoRTAD_SSTA_Dir}/SSTA_tm3/sstANOM_FREQ_main_stats.dat 64 16 Log=LOG/ssta_lltm_sstANOM_FREQ_main.log; $bindir/create_SSTA.x landdir=${CoRTAD_Land_Dir} indir=${CoRTAD_SSTA_Dir}/SSTA_tm nogdir=${CoRTAD_SST_Dir}/WeeklyCNT outdir=${CoRTAD_SSTA_Dir}/SSTA_NC outfile=cortadv6_SSTA.nc
##         comment: CoRTAD weekly sea surface temperature is derived from Pathfinder 5.3 variable "sea_surface_temperature"
##         license: These data are available for use without restriction.
##         id: 0
##         naming_authority: gov.noaa.nodc
##         product_version: V6.0
##         uuid: 10FE14FD-D326-4DCB-ABEF-ABBF6D6AAF7A
##         netcdf_version_id: 4.2
##         date_created: 20220516T212206Z
##         date_issued: 20220516T212206Z
##         geospatial_lat_units: degrees north
##         geospatial_lat_resolution: 0.04165 degrees
##         geospatial_lon_units: degrees east
##         geospatial_lon_resolution: 0.04165 degrees
##         geospatial_vertical_units: meters
##         geospatial_vertical_resolution: point
##         geospatial_vertical_positive: down
##         geospatial_lon_min: -179.979202270508
##         geospatial_lon_max: 179.979202270508
##         geospatial_lat_min: -89.9791717529297
##         geospatial_lat_max: 89.9791717529297
##         geospatial_vertical_min: 0
##         geospatial_vertical_max: 0
##         northernmost_latitude: 89.9791717529297
##         southernmost_latitude: -89.9791717529297
##         easternmost_longitude: 179.979202270508
##         westernmost_longitude: -179.979202270508
##         time_coverage_start: 19820102T000000Z
##         time_coverage_end: 20211224T235959Z
##         time_coverage_units: days
##         time_coverage_duration: P31Y1M28D
##         time_coverage_resolution: P7D
##         source: Version 6 of the Coral Reef Temperature Anomaly Database (CoRTAD) is a global, 4 km, sea surface temperature (SST) and related thermal stress metrics dataset for 1982-01-02 to 2020-12-25. The CoRTAD contains weekly-averaged SSTs, SST anomaly (SSTA, weekly SST minus weekly climatological SST), thermal stress anomaly (TSA, weekly SST minus the maximum weekly climatological SST), SSTA Degree Heating Week (SSTA_DHW, sum of previous 12 weeks when SSTA is greater than or equal to 1 degree C), SSTA Frequency (number of times over previous 52 weeks that SSTA is greater than or equal to 1 degree C), TSA DHW (TSA_DHW, also known as a Degree Heating Week, sum of previous 12 weeks when TSA is greater than or equal to 1 degree C), and TSA Frequency (number of times over previous 52 weeks that TSA is greater than or equal to 1 degree C). In addition, the CoRTAD includes ancillary sea ice concentration and marine winds speed data.
##         platform: NOAA-7, NOAA-9, NOAA-11, NOAA-9, NOAA-14, NOAA-16, NOAA-17, NOAA-18, NOAA-19
##         sensor: AVHRR_GAC
##         grid_mapping: Equidistant Cylindrical
##         Metadata_Conventions: Unidata Dataset Discovery v1.0
##         metadata_link: http://www.nodc.noaa.gov/SatelliteData/Cortad/
##         keywords: Oceans > Ocean Temperature > Sea Surface Temperature
##         keywords_vocabulary: NASA/Global Change Master Directory (GCMD) Earth Science Keywords v8.0
##         standard_name_vocabulary: Climate and Forecast (CF) Standard Name Table v27
##         acknowledgment: Please acknowledge the use of these data with the following statement: These data were provided by GHRSST and the US National Oceanographic Data Center. This project was supported in part by a grant from the NOAA Climate Data Record (CDR) Program for satellites.
##         creator_name: Kenneth S. Casey
##         creator_email: Kenneth.Casey@noaa.gov
##         creator_url: http://www.nodc.noaa.gov/SatelliteData/Cortad/
##         contributor_name: Elizabeth R. Selig
##         contributor_role: Principal Investigator
##         project: Coral Reef Temperature Anomaly Database
##         publisher_name: National Centers for Environmental Information (NCEI), NOAA
##         publisher_email: NODC.Services@noaa.gov
##         publisher_url: http://www.nodc.noaa.gov/
##         processing_level: Level 4
##         cdm_data_type: Grid
##         feature_type: Grid
##         nodc_template_version: NODC_NetCDF_Grid_Template_v1.1
##         platform_dates: NOAA-7 1981236-1985003, NOAA-9 1985004-1988312, NOAA-11 1988313-1994256, NOAA-9 1994257-1995021, NOAA-14 1995022-2000285, NOAA-16 2000286-2002365, NOAA-17 2003001-2005155, NOAA-18 2005156-2010365, NOAA-19 2011001-2020366
##         instrument: AVHRR_GAC
##         project_acronym: CoRTAD
##         project_support: National Centers for Environmental Information (NCEI), NOAA Coral Reef Conservation Program (CRCP)
##         time_period_covered: Weekly, 1982-01-02 - 2021-12-24
##         rows: 4320
##         cols: 8640
##         timesteps: 2086
##         DODS_EXTRA.Unlimited_Dimension: time

Like the SST dataset, the SSTA dataset contains many variables. Let’s choose the raw SSTA. If we had included more time steps in our data request, we would need to specify the year. Since we only downloaded data for 1982, however, we don’t need to specify the time. Like before, we will also grab lat and lon for our map.

# Get variables from SSTA data
ssta <- ncvar_get(ssta_first, "SSTA")
lon <- ncvar_get(ssta_first, "lon")
lat <- ncvar_get(ssta_first, "lat")
lat <- rev(lat)

nc_close(ssta_first)

Next, create a raster with the data and plot it.

r <- raster(t(ssta), xmn = min(lon), xmx = max(lon), ymn = min(lat), ymx = max(lat))

plot(r)

The colors in this map represent the difference in sea surface temperature at a location to its climatological mean. Because we have so many data points across the world, it is a bit hard to see where the SSTA is above average (0). Let’s plot only the points where SSTA > 0.

plot(r > 0)

print(length(which(ssta > 0)))
## [1] 10679007

This gives us an idea for how the sea surface temperature in 1982 differed from the climate normal. Next, let’s investigate SSTA for 2019.

# Get variables from SST data
ssta <- ncvar_get(ssta_last, "SSTA")
lon <- ncvar_get(ssta_last, "lon")
lat <- ncvar_get(ssta_last, "lat")
lat <- rev(lat)

nc_close(ssta_last)
r <- raster(t(ssta), xmn = min(lon), xmx = max(lon), ymn = min(lat), ymx = max(lat))

plot(r) 

plot(r > 0)

print(length(which(ssta > 0)))
## [1] 13028413

What do you notice about the graphs we have made? How does SSTA for 1982 differ from SSTA for 2019?

Where to go from here

Great job creating those plots! I hope you have a better understanding of how scientists store environmental data as well as how to access and explore that data. NOAA’s THREDDS server has many more datasets to explore. Find another dataset or variable you’re interested in, and explore that as well (one interesting one is CoRTAD Thermal Stress Anomaly. Another great dataset to accompany your SST metrics study would be a set of coordinates for major coral reef locations (see bonus section).

Although we have created some great maps, we could definitely improve on these. Try adding a nice title and legend to your map, or changing the color scales for SSTA values. If you wanted, you could even try to overlay a world map onto your plot.

Other NOAA Data

NOAA has petabytes of data available to the public. To find more interesting datasets, explore the THREDDS server from a browser, check out data available via cloud providers, the NOAA Data Catalog, or check out some of NOAA’s many data portals such as CoastWatch.

Bonus: Coral Reef locations

NOAA’s Deep Sea Coral and Sponge Map Portal contains information on coral and sponge populations around the world. This could be an interesting dataset to pair with our SST data. Here is some code to get you started:

library(readr)
# Access and download data at https://www.ncei.noaa.gov/maps/deep-sea-corals/mapSites.htm
# Download the data to your machine and change the path below
deep_sea_corals <- read_csv("../../deep_sea_corals.csv")
## Rows: 879233 Columns: 22
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (20): DataProvider, ScientificName, VernacularNameCategory, TaxonRank, S...
## dbl  (2): CatalogNumber, ShallowFlag
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
deep_sea_corals
plot(r)
points(deep_sea_corals$longitude, deep_sea_corals$latitude, cex=0.25)
## Warning in xy.coords(x, y): NAs introduced by coercion

## Warning in xy.coords(x, y): NAs introduced by coercion

Can you make an interesting plot with these datasets? Try it out below!